﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataVisit.Factory;
using System.Collections;

namespace DataVisit.Handler.View
{
    public class RecyclingView:AbstractView
    {
        /// <summary>
        /// 回收实例
        /// </summary>
        public void GetHS() 
        {
            var year = JsonRequest.GetParam<string>("year");
            var month = JsonRequest.GetParam<string>("month");
            var groupname = JsonRequest.GetParam<string>("groupname");
            JsonResponse.ResponseObject = DaoFactory.RecyclingDao.GetRecycling_HS(year+"-"+month+"-01",groupname);
        }

        /// <summary>
        /// 复用实例
        /// </summary>
        public void GetFy() 
        {
            var year = JsonRequest.GetParam<string>("year");
            var month = JsonRequest.GetParam<string>("month");
            var groupName = JsonRequest.GetParam<string>("groupname");
            JsonResponse.ResponseObject = DaoFactory.RecyclingDao.GetRecycling_FY(year + "-" + month + "-01", groupName);
        }

        public void GetYearTime()
        {
            IList<YearTime> list = new List<YearTime>();
            var currentyear = Convert.ToInt32(DateTime.Now.ToString("yyyy-MM-dd").Split('-')[0]);
            for (int i = 8; i > 0; i--)
            {
                YearTime yt = new YearTime();
                yt.yearid = currentyear.ToString();
                yt.yeartext = currentyear.ToString();
                list.Add(yt);
                currentyear -= 1;
            }
            JsonResponse.ResponseObject = list;
        }
    }

    public class YearTime
    {
        public string yearid { get; set; }
        public string yeartext { get; set; }
    }
}
